//
//  MyWalleViewController.m
//  BusinessApp
//
//  Created by macox on 16/9/30.
//  Copyright © 2016年 macox. All rights reserved.
//

#import "MyWalleViewController.h"
#import "BalanceCashViewController.h"
#import "MyWalleModel.h"
#import "RuZhuViewController.h"
@interface MyWalleViewController ()
{
    NSString *yueER;
}
@end

@implementation MyWalleViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"我的钱包";
    UIImage *classBackImage = [UIImage imageNamed:@"zuojiantou@3x-1"];
    classBackImage = [classBackImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:classBackImage style:UIBarButtonItemStylePlain target:self action:@selector(classBackAction)];
    // Do any additional setup after loading the view from its nib.
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.StoreName.text = SHOPNAME;
    self.PhoneNum.text  = GETPHONE;
    [self requestDataMyWalle];
}
- (void)requestDataMyWalle{
//    _goodDataStatusArr = [NSMutableArray array];
    NSDictionary *param = @{@"ShouJiHao":GETPHONE,@"Duuid":GETUUID,@"Token":GETTOKEN};
    [GDJHttpTool get:MineInfo params:param success:^(id responseObj) {
        NSLog(@"%@", responseObj);
                NSLog(@"%@", param);
        if ([[responseObj objectForKey:@"Err"] intValue]) {
            
        }else{
            
            NSDictionary *dataArr = [responseObj objectForKey:@"MineInfo"];
            
            MyWalleModel *model = [MyWalleModel mj_objectWithKeyValues:dataArr];
            
            _YuerLabel.text = [NSString stringWithFormat:@"%@元",model.ShopYuE] ;
            yueER = [NSString stringWithFormat:@"%@元",model.ShopYuE] ;
            _DayAccount.text = [NSString stringWithFormat:@"%@",model.TodayTotal] ;
            _LeijiShouru.text = [NSString stringWithFormat:@"%@",model.LeiJiShouRu] ;
            _LeijiChengjiaoDingdan.text = [NSString stringWithFormat:@"%@",model.OrderCount];
            _LeijiTIxian.text = [NSString stringWithFormat:@"%@",model.LeiJiTiXian] ;
        }
        
    } failure:^(NSError *error) {
        NSLog(@"%@",error);
    }];
    

}
#pragma mark -- 返回
- (void)classBackAction{
    [self.navigationController popViewControllerAnimated:YES];
}
- (IBAction)BalanceBtnAction:(UIButton *)sender {
    NSLog(@"余额");
//    RuZhuViewController *ruzhuVC = [[RuZhuViewController alloc]init];
//    self.hidesBottomBarWhenPushed=YES;
//    [self.navigationController pushViewController:ruzhuVC animated:YES];
//    self.hidesBottomBarWhenPushed=NO;
//    [self.navigationController pushViewController:ruzhuVC animated:YES];
    BalanceCashViewController *balanceCashVC = [[BalanceCashViewController alloc]init];
    NSLog(@"++________%@", yueER);
    balanceCashVC.MoneyAccount = yueER;
    self.hidesBottomBarWhenPushed=YES;
    [self.navigationController pushViewController:balanceCashVC animated:YES];

}
- (IBAction)RechargeBtnAction:(UIButton *)sender {
    NSLog(@"充值");
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
